{extend name="layout/common_layout" /}
{block name="body"}
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">分类管理</li>
            <li class=""><a href="{:url('admin/floor/add')}">添加分类</a></li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th style="width: 30px;">ID</th>
                        <th>分类名称</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {foreach name="category_level_list" item="vo"}
                    <tr>
                        <td>{$vo.id}</td>
                        <td>
                            {neq name="vo.level" value="1"}{php}for($i=1;$i<$vo['level'];$i++){echo '&nbsp;&nbsp;&nbsp;└─';}{/php}{/neq} {$vo.name}
                            {if condition="$vo.pid eq 0"}

                            {else/}
                            吨价:{$vo.price} 大度系数:{$vo.largecoefficient} 正度系数:{$vo.positivecoefficient}
                            {/if}
                        </td>
                        <td>
                            {if condition="$vo['level']  eq 1"}
                            <a href="{:url('admin/floor/addpaperinfo',['pid'=>$vo['id']])}" class="layui-btn layui-btn-mini">添加纸质</a>
                            <a href="{:url('admin/floor/edit',['id'=>$vo['id']])}" class="layui-btn layui-btn-normal layui-btn-mini">编辑</a>
                            {/if}
                            {if condition="$vo['level']  neq 1"}
                            <a href="{:url('admin/floor/editpaperinfo',['id'=>$vo['id']])}" class="layui-btn layui-btn-normal layui-btn-mini">编辑</a>
                            <a class="layui-btn layui-btn-normal layui-btn-mini" href="javascript:;" onclick="goodsIndex(this);" data-url="{:url('admin/spec/index',array('cate2_id'=>$vo['id']))}">纸质克数</a>
                            <a href="{:url('admin/floor/delete',['id'=>$vo['id']])}" class="layui-btn layui-btn-danger layui-btn-mini ajax-delete">删除</a>
                            {/if}
                        </td>
                    </tr>
                    {/foreach}
                    </tbody>
                </table>
                <!--分页-->

            </div>
        </div>
    </div>
{/block}

{block name="js"}
<script type="text/javascript" src="__JS__/dialog/layer.js"></script>
{/block}

{block name="script"}
<script>

    //弹框：
    function goodsIndex(th){
        var open_url = $(th).attr('data-url');
        if(open_url){
            layer.open({
                type: 2,
                title:'规格列表',
                btn: ['确定','关闭'],
                shade: [0.8, '#808080'],
                closeBtn:1,
                area: ['700px','500px'],
                maxmin: false,
                content: open_url,
                zIndex: 1001,
                success: function(layero){
                },
                yes:function(index, layero){
                    var id = $(th).attr('index');
                }
            });
        }
    }

    function goodsIndexUnit(th){


        var open_url = $(th).attr('data-url');
        if(open_url){
            layer.open({
                type: 2,
                title:'单位列表',
                btn: ['确定','关闭'],
                shade: [0.8, '#808080'],
                closeBtn:1,
                area: ['700px','500px'],
                maxmin: false,
                content: open_url,
                zIndex: 1001,
                success: function(layero){
                },
                yes:function(index, layero){
                    var id = $(th).attr('index');
                }
            });
        }
    }

</script>
{/block}